package com.yx.changdao.common.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.github.liaochong.myexcel.core.annotation.ExcelColumn;
import com.github.liaochong.myexcel.core.annotation.ExcelModel;
import com.github.liaochong.myexcel.core.annotation.IgnoreColumn;
import com.yx.changdao.common.annotation.AutoFill;
import com.yx.changdao.common.utils.SysUtils;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.ExceptionHandler;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;


@TableName(CommunityBuild.TABLE_NAME)
@Getter
@Setter
@ExcelModel(excludeParent = true, ignoreStaticFields = true)
public class CommunityBuild implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 数据库名
     */
    public static final String TABLE_NAME = "community_build";

    /**
     * 建筑物id
     */
    public static final String ID = "id";
    /**
     * 导入建筑表格时的唯一id
     */
    public static final String GRID_BUILD_ID="grid_build_id";
    /**
     * 网格id
     */
    public static final String GRID_ID = "grid_id";
    /**
     * 建筑类型（0：住宅 1：商铺）
     */
    public static final String BUILD_TYPE = "build_type";
    public static final String BUILD_CODE ="build_code";
    /**
     *门楼牌号
     */
    public static final String GATEHOUSE_NUMBER = "gatehouse_number";
    /**
     * 管理主体
     */
    public static final String MANAGEMENT_BODY = "management_body";
    /**
     * 商铺名称
     */
    public static final String SHOP_NAME = "shop_name";
    /**
     * 商铺地址
     */
    public static final String SHOP_ADDRESS = "shop_address";
    /**
     * 部门id
     */
    public static final String DEP_ID = "dep_id";
    /**
     * 部门名称
     */
    public static final String DEP_NAME = "dep_name";

    /**
     * 经营范围
     */
    public static final String BUSINESS_SCOPE = "business_scope";
    /**
     * 商铺联系人
     */
    public static final String SHOP_CONTACT_PERSON = "shop_contact_person";
    /**
     * 手机号码
     */
    public static final String CONTACT_PHONE = "contact_phone";
    /**
     * 联系人姓名
     */
    public static final String LINK_NAME = "link_name";
    /**
     * 联系人电话
     */
    public static final String LINK_PHONE = "link_phone";
    /**
     * 联系人身份证
     */
    public static final String LINK_ID_CARD = "link_id_card";


    /**
     * 采集工作人员id（待定）
     */
    public static final String WORKER_ID = "worker_id";
    /**
     * 建筑物名称
     */
    public static final String BUILD_NAME = "build_name";
    /**
     * 单元数
     */
    public static final String UNIT = "unit";
    /**
     * 楼层
     */
    public static final String LAYERS = "layers";
    /**
     * 建筑户数
     */
    public static final String HOUSE_NUMBER = "house_number";
    /**
     * 机关干部户数
     */
    public static final String OFFICIALS_HOMES = "officials_homes";
    /**
     * 实有住户
     */
    public static final String REAL_HOMES = "real_homes";
    /**
     * 空户数
     */
    public static final String EMPTY_HOMES = "empty_homes";
    /**
     * 产权年限
     */
    public static final String PROPETRY_YEAR = "propetry_year";
    /**
     * 产权性质
     */
    public static final String PROPERTY = "property";
    /**
     * 竣工年份
     */
    public static final String COMPLETION = "completion";
    /**
     * 开发主体
     */
    public static final String DEVELOPER = "developer";
    /**
     * 位置信息(街道，下拉选择)（待定）
     */
    public static final String STREET = "street";
    /**
     * 楼长电话
     */
    public static final String BUILD_MANAGE_PHONE = "build_manage_phone";
    /**
     * 楼长姓名
     */
    public static final String BUILD_MANAGE_NAME = "build_manage_name";
    /**
     * 身体状况
     */
    public static final String PHYSICAL_CONDITION =  "physical_condition";
    /**
     * 是否通电
     */
    public static final String ELECTRICITY = "electricity";
    /**
     * 是否通水
     */
    public static final String WATER = "water";
    /**
     * 是否通气
     */
    public static final String GAS = "gas";
    /**
     * 是否通暖
     */
    public static final String HEATER = "heater";
    /**
     * 土地性质
     */
    public static final String LAND_NATURE = "land_nature";
    /**
     * 土地用途
     */
    public static final String LAND_USE = "land_use";
    /**
     * 创建时间
     */
    public static final String CREATE_TIME = "create_time";
    /**
     * 创建人
     */
    public static final String CREATE_BY_NAME = "create_by_name";
    /**
     * 创建人id
     */
    public static final String CREATE_BY = "create_by";
    /**
     * 更新时间
     */
    public static final String UPDATE_TIME = "update_time";
    /**
     * 更新人
     */
    public static final String UPDATE_BY_NAME = "update_by_name";
    /**
     * 更新人id
     */
    public static final String UPDATE_BY = "update_by";
    /**
     * 楼信息
     */
    public static final String BUILDINGINFORMATION = "buildingInformation";

    public static final String REMARK ="remark";
    /**
     * 建筑物id
     */
    @TableId(type = IdType.AUTO)
    @IgnoreColumn
    private Integer id;

    @ExcelColumn(index = 0,title = "楼编号")
    private String buildCode;

    @ExcelColumn(index = 1, title = "网格编号")
    @TableField(exist = false)
    private String gridNum;


    /**
     * 建筑类型（0：住宅 1：商铺）暂定几建筑类型（0：住宅 1：商铺
     */
    @NotNull(message = "建筑类型不能为空")
//    @ExcelColumn(index = 2, title = "建筑类型",mapping = "0:住宅,1:商铺")
    @IgnoreColumn
    private Integer buildType;
    /**
     * 部门id
     */
    @IgnoreColumn
    @ExcelColumn(index = 2, title = "联系部门")
    private String depName;

    /**
     * 商铺名称
     */
//    @ExcelColumn(index = 3, title = "商铺名称")
    @IgnoreColumn
    private String shopName;
    /**
     * 商铺地址
     */
//    @ExcelColumn(index = 4, title = "商铺地址")
    @IgnoreColumn
    private String shopAddress;
    /**
     * 经营范围
     */
//    @ExcelColumn(index = 5, title = "经营范围")
    @IgnoreColumn
    private String businessScope;
    /**
     * 商铺联系人
     */
//    @ExcelColumn(index = 6, title = "商铺联系人")
    @IgnoreColumn
    private String shopContactPerson;
    /**
     * 手机号码
     */
//    @ExcelColumn(index = 7, title = "手机号码")
    @IgnoreColumn
    private String contactPhone;
    /**
     * 联系人姓名
     */
//    @ExcelColumn(index = 8, title = "联户人姓名")
    @IgnoreColumn
    private String linkName;
    /**
     * 联系人电话
     */
//    @ExcelColumn(index = 9, title = "联户人电话")
    @IgnoreColumn
    private String linkPhone;
    /**
     * 联系人身份证
     */
//    @ExcelColumn(index = 10, title = "联户人身份证")
    @IgnoreColumn
    private String linkIdCard;
    /**
     * 建筑物名称
     */
    @ExcelColumn(index = 3, title = "楼宇/平房名称")
    @IgnoreColumn
    private String buildName;


    /**
     * 门楼牌号
     */
    @ExcelColumn(index = 4, title = "门楼牌号")
    @IgnoreColumn
    private String gatehouseNumber;

    /**
     *  管理主体
     */
    @ExcelColumn(index = 5, title = "管理主体")
    @IgnoreColumn
    private String managementBody;

    /**
     * 单元数
     */
    @ExcelColumn(index = 6, title = "单元数")
    @IgnoreColumn
    private Integer unit;

    /**
     * 楼层
     */
    @ExcelColumn(index = 7, title = "楼层数")
    @IgnoreColumn
    private Integer layers;

    /**
     * 建筑户数
     */
    @ExcelColumn(index = 8, title = "建筑户数")
    @IgnoreColumn
    private Integer houseNumber;
    /**
     * 实有住户
     */
    @ExcelColumn(index = 9, title = "实有户数")
    @IgnoreColumn
    private Integer realHomes;

    @ExcelColumn(index = 10,title = "机关干部户数")
    @IgnoreColumn
    private Integer  officialsHomes;
    /**
     * 空住户
     */
    @ExcelColumn(index = 11, title = "空户数")
    @IgnoreColumn
    private Integer emptyHomes;
    /**
     * 竣工年份
     */
    @ExcelColumn(index = 12, title = "竣工年限",format = "yyyy-MM-dd")
    @IgnoreColumn
    private Date completion;
    /**
     * 开发主体
     */
    @ExcelColumn(index = 13, title = "开发主体")
    @IgnoreColumn
    private String developer;

    /**
     * 产权性质
     */
    @ExcelColumn(index = 14, title = "产权性质")
    @IgnoreColumn
    private String property;


    /**
     * 产权年限
     */
    @ExcelColumn(index = 15, title = "产权年限")
    @IgnoreColumn
    private String propetryYear;

    /**
     * 位置信息(街道，下拉选择)（待定）
     */
    @ExcelColumn(index = 16, title = "地理位置")
    @IgnoreColumn
    private String street;

    /**
     * 楼长姓名
     */
    @ExcelColumn(index = 17, title = "楼长姓名")
    @IgnoreColumn
    private String buildManageName;

    /**
     * 楼长电话
     */
    @ExcelColumn(index = 18, title = "楼长电话")
    @IgnoreColumn
    private String buildManagePhone;


    /**
     * 是否通水
     */
    @ExcelColumn(index = 19, title = "是否通水",mapping = "0:是,1:否")
    @IgnoreColumn
    private Integer water;
    /**
     * 是否通电
     */
    @ExcelColumn(index = 20, title = "是否通电" ,mapping = "0:是,1:否")
    @IgnoreColumn
    private Integer electricity;
    /**
     * 是否通气
     */
    @ExcelColumn(index = 21, title = "是否通气" ,mapping = "0:是,1:否")
    @IgnoreColumn
    private Integer gas;
    /**
     * 是否通暖
     */
    @ExcelColumn(index = 22, title = "是否通暖" ,mapping = "0:是,1:否")
    @IgnoreColumn
    private Integer heater;

    /**
     * 土地性质
     */
    @ExcelColumn(index = 23, title = "土地性质")
    @IgnoreColumn
    private String landNature;
    /**
     * 土地用途
     */
    @ExcelColumn(index = 24, title = "土地用途")
    @IgnoreColumn
    private String landUse;


    /**
     * 采集工作人员id（待定）
     */
    @IgnoreColumn
    private Integer workerId;


    /**
     * 身体状况
     */
    @IgnoreColumn
    private String physicalCondition;

    /**
     * 楼信息
     */
    @IgnoreColumn
    private String buildingInformation;
    /**
     * 在导入数据时和网格做连接
     */
    @IgnoreColumn
    private String gridBuildId;


    /**
     * 创建时间
     */
    @AutoFill
    @TableField(fill = FieldFill.INSERT)
    @IgnoreColumn
    private Date createTime;
    /**
     * 创建人
     */
    @IgnoreColumn
    @AutoFill(klass= SysUtils.class,method = "currentUserName")
    @TableField(fill = FieldFill.INSERT)
    private String createByName;
    /**
     * 创建人id
     */
    @IgnoreColumn
    @AutoFill(klass= SysUtils.class,method = "currentUserId")
    @TableField(fill = FieldFill.INSERT)
    private String createBy;
    /**
     * 更新时间
     */
    @IgnoreColumn
    @AutoFill
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;
    /**
     * 更新人
     */
    @IgnoreColumn
    @AutoFill(klass= SysUtils.class,method = "currentUserName")
    @TableField(fill = FieldFill.UPDATE)
    private String updateByName;
    /**
     * 更新人id
     */
    @IgnoreColumn
    @AutoFill(klass= SysUtils.class,method = "currentUserId")
    @TableField(fill = FieldFill.UPDATE)
    private String updateBy;

    @IgnoreColumn
    private String remark;

    /**
     * 部门id
     */
    @IgnoreColumn
    private Integer depId;



    /**
     * 网格id
     */
    @NotNull(message = "网格不能为空")
    @IgnoreColumn
    private Integer gridId;

    @IgnoreColumn
    private Integer residents;

}
